 /* -----------------------------------------------------------
 * Author: Maria Powell
 * Testing Function: playSmithy() 
 * Function Description: This card implements Smithy Card:
 * 						 Add 3 Cards to the Hand
 * What to test: This test ensures that three cards are added to 
 * 				 the players hand after playing the smithy card.
 * How to test: I will set the gamestate which should have 5 
 * 				handcards and then check of there are 8 handcards
 * 				after playing the smithy card.
 -----------------------------------------------------------*/

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

//Set NOISY test to 0 to remove printfs from output console
#define NOISY_TEST 1

int main()
{
	//Initialization
	int i = 0;
	int firstPlayer = 0;
	int secondPlayer = 1;
	int numPlayers = 2;
	int handPos = 0;
	int currentHandCount = 0;
	int shouldBeHandCount = 0;
	int toHand = 2;
	int notNeeded = 0;
	int addThreeCards = 3;
	int seed = 1000;
	int k[10] = {adventurer, council_room, feast, gardens, mine,
				remodel, smithy, village, baron, great_hall};
	struct gameState G;


	printf("TESTING  playSmithy()\n");
	#if (NOISY_TEST == 1)
		printf("Initializing gameState....\n");
	#endif

	//set gameState
	memset(&G, 23, sizeof(struct gameState));
	initializeGame(numPlayers, k, seed, &G);
	currentHandCount = G.handCount[firstPlayer];	
	shouldBeHandCount = currentHandCount + addThreeCards;
	
	//add smithy card to hand deck
	gainCard(smithy, &G, toHand, firstPlayer);
	
	//set smithy hand position
    for(i = 0; i < MAX_HAND; i++)
	{
		if(G.hand[firstPlayer][i] == smithy)
		{
			handPos = i;
		} 
	}	

	//play Smithy card
	//playSmithy(firstPlayer, &G, handPos);
	cardEffect(smithy, notNeeded, notNeeded, notNeeded, &G, handPos, &notNeeded);
	assert(G.handCount[firstPlayer] == shouldBeHandCount);	

	#if (NOISY_TEST == 1)
		printf("Unit Tests Passed\n");
	#endif
	return 0;
}
